using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class huqiang_Unit_HotUnit_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(huqiang.Unit.HotUnit);
            args = new Type[]{typeof(huqiang.Unit.UnitCarrier)};
            method = type.GetMethod("CreateMesh", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, CreateMesh_0);
            args = new Type[]{typeof(huqiang.Unit.Unit)};
            method = type.GetMethod("OnCollision", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, OnCollision_1);
            args = new Type[]{typeof(System.Single)};
            method = type.GetMethod("OnUpdate", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, OnUpdate_2);

            field = type.GetField("Context", flag);
            app.RegisterCLRFieldGetter(field, get_Context_0);
            app.RegisterCLRFieldSetter(field, set_Context_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_Context_0, AssignFromStack_Context_0);
            field = type.GetField("createMesh", flag);
            app.RegisterCLRFieldGetter(field, get_createMesh_1);
            app.RegisterCLRFieldSetter(field, set_createMesh_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_createMesh_1, AssignFromStack_createMesh_1);
            field = type.GetField("onCollision", flag);
            app.RegisterCLRFieldGetter(field, get_onCollision_2);
            app.RegisterCLRFieldSetter(field, set_onCollision_2);
            app.RegisterCLRFieldBinding(field, CopyToStack_onCollision_2, AssignFromStack_onCollision_2);
            field = type.GetField("onUpdate", flag);
            app.RegisterCLRFieldGetter(field, get_onUpdate_3);
            app.RegisterCLRFieldSetter(field, set_onUpdate_3);
            app.RegisterCLRFieldBinding(field, CopyToStack_onUpdate_3, AssignFromStack_onUpdate_3);


            app.RegisterCLRCreateDefaultInstance(type, () => new huqiang.Unit.HotUnit());
            app.RegisterCLRCreateArrayInstance(type, s => new huqiang.Unit.HotUnit[s]);

            args = new Type[]{};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);

        }


        static StackObject* CreateMesh_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Unit.UnitCarrier @carrier = (huqiang.Unit.UnitCarrier)typeof(huqiang.Unit.UnitCarrier).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            huqiang.Unit.HotUnit instance_of_this_method = (huqiang.Unit.HotUnit)typeof(huqiang.Unit.HotUnit).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.CreateMesh(@carrier);

            return __ret;
        }

        static StackObject* OnCollision_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Unit.Unit @other = (huqiang.Unit.Unit)typeof(huqiang.Unit.Unit).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            huqiang.Unit.HotUnit instance_of_this_method = (huqiang.Unit.HotUnit)typeof(huqiang.Unit.HotUnit).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.OnCollision(@other);

            return __ret;
        }

        static StackObject* OnUpdate_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Single @time = *(float*)&ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            huqiang.Unit.HotUnit instance_of_this_method = (huqiang.Unit.HotUnit)typeof(huqiang.Unit.HotUnit).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.OnUpdate(@time);

            return __ret;
        }


        static object get_Context_0(ref object o)
        {
            return ((huqiang.Unit.HotUnit)o).Context;
        }

        static StackObject* CopyToStack_Context_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Unit.HotUnit)o).Context;
            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance, true);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method, true);
        }

        static void set_Context_0(ref object o, object v)
        {
            ((huqiang.Unit.HotUnit)o).Context = (System.Object)v;
        }

        static StackObject* AssignFromStack_Context_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Object @Context = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.Unit.HotUnit)o).Context = @Context;
            return ptr_of_this_method;
        }

        static object get_createMesh_1(ref object o)
        {
            return ((huqiang.Unit.HotUnit)o).createMesh;
        }

        static StackObject* CopyToStack_createMesh_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Unit.HotUnit)o).createMesh;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_createMesh_1(ref object o, object v)
        {
            ((huqiang.Unit.HotUnit)o).createMesh = (System.Action<huqiang.Unit.UnitCarrier>)v;
        }

        static StackObject* AssignFromStack_createMesh_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Action<huqiang.Unit.UnitCarrier> @createMesh = (System.Action<huqiang.Unit.UnitCarrier>)typeof(System.Action<huqiang.Unit.UnitCarrier>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)8);
            ((huqiang.Unit.HotUnit)o).createMesh = @createMesh;
            return ptr_of_this_method;
        }

        static object get_onCollision_2(ref object o)
        {
            return ((huqiang.Unit.HotUnit)o).onCollision;
        }

        static StackObject* CopyToStack_onCollision_2(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Unit.HotUnit)o).onCollision;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_onCollision_2(ref object o, object v)
        {
            ((huqiang.Unit.HotUnit)o).onCollision = (System.Action<huqiang.Unit.Unit>)v;
        }

        static StackObject* AssignFromStack_onCollision_2(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Action<huqiang.Unit.Unit> @onCollision = (System.Action<huqiang.Unit.Unit>)typeof(System.Action<huqiang.Unit.Unit>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)8);
            ((huqiang.Unit.HotUnit)o).onCollision = @onCollision;
            return ptr_of_this_method;
        }

        static object get_onUpdate_3(ref object o)
        {
            return ((huqiang.Unit.HotUnit)o).onUpdate;
        }

        static StackObject* CopyToStack_onUpdate_3(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Unit.HotUnit)o).onUpdate;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_onUpdate_3(ref object o, object v)
        {
            ((huqiang.Unit.HotUnit)o).onUpdate = (System.Action<System.Single>)v;
        }

        static StackObject* AssignFromStack_onUpdate_3(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Action<System.Single> @onUpdate = (System.Action<System.Single>)typeof(System.Action<System.Single>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)8);
            ((huqiang.Unit.HotUnit)o).onUpdate = @onUpdate;
            return ptr_of_this_method;
        }



        static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new huqiang.Unit.HotUnit();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


    }
}
